<!--
 * @Author: wang 1062637288@qq.com
 * @Date: 2022-12-16 20:32:49
 * @LastEditors: wang 1062637288@qq.com
 * @LastEditTime: 2022-12-17 11:54:58
 * @FilePath: \app\src\pages\user\index.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
    <view>
        <view class="iot-user_info_wrap">
            <view v-if="userinfo.avatarUrl" class="iot-user_img_wrap">
                <image class="iot-user_bg" :src="userinfo.avatarUrl"></image>
                <view class="iot-user_info">
                    <image class="iot-user_icon" :src="userinfo.avatarUrl"></image>
                    <view class="iot-user_name">{{ userinfo.nickName }}</view>
                </view>
            </view>
            <view v-else class="iot-user_btn">
                <navigator url="/pages/login/index">登录</navigator>
            </view>
        </view>
        <view class="iot-user_content">
            <view class="iot-user_main">
                <!-- 历史足迹 -->
                <view class="iot-history_wrap">
                    <navigator>
                        <view class="iot-his_num">0</view>
                        <view class="iot-his_name">收藏的店铺</view>
                    </navigator>
                    <navigator url="/pages/collect/index">
                        <view class="iot-his_num">{{ collectNums }}</view>
                        <view class="iot-his_name">收藏的商品</view>
                    </navigator>
                    <navigator>
                        <view class="iot-his_num">0</view>
                        <view class="iot-his_name">关注的商品</view>
                    </navigator>
                    <navigator>
                        <view class="iot-his_num">0</view>
                        <view class="iot-his_name">我的足迹</view>
                    </navigator>
                </view>
                <!-- 我的订单 -->
                <view class="iot-orders_wrap">
                    <view class="iot-orders_title">我的订单</view>
                    <view class="iot-order_content">
                        <navigator url="/pages/order/index?type=1">
                            <view class="iconfont icon-fufeidan"></view>
                            <view class="iot-order_name">全部订单</view>
                        </navigator>
                        <navigator url="/pages/order/index?type=2">
                            <view class="iconfont icon-fufei"></view>
                            <view class="iot-order_name">待付款</view>
                        </navigator>
                        <navigator url="/pages/order/index?type=3">
                            <view class="iconfont icon-huoche_o"></view>
                            <view class="iot-order_name">待收货</view>
                        </navigator>
                        <navigator>
                            <view class="iconfont icon-fukuantongzhi"></view>

                            <view class="iot-order_name">退款/退货</view>
                        </navigator>
                    </view>
                </view>
                <!-- 收货地址管理 -->
                <view class="iot-address_wrap">收货地址管理</view>
                <!-- 应用信息相关 -->
                <view class="iot-app_info_wrap">
                    <view class="iot-app_info_item iot-app_info_contact">
                        <text>联系客服</text>
                        <text>400-618-4000</text>
                    </view>
                    <navigator url="/pages/feedback/index" class="iot-app_info_item">意见反馈</navigator>
                    <view class="iot-app_info_item">关于我们</view>
                </view>
                <!-- 推荐 -->
                <view class="iot-recommend_wrap">把应用推荐给其他人</view>
            </view>
        </view>
    </view>
</template>

<script>
// pages/user/index.js
export default {
    data() {
        return {
            userinfo: {
                avatarUrl: '',
                nickName: ''
            },
            // 被收藏的商品的数量
            collectNums: 0
        };
    },
    onShow() {
        const userinfo = uni.getStorageSync('userinfo');
        const collect = uni.getStorageSync('collect') || [];
       
            this.userinfo=userinfo,
            this.collectNums=collect.length
       
    },
    methods: {}
};
</script>
<style>
@import './index.css';
</style>
